const app = getApp();
Page({
  data: {
    template_zhuan:[]
  },
  
  onLoad: function (options) {
    const that = this;
    app.util.request({
      url: 'Index/Index/getOrderList', // 仅为示例，并非真实的接口地址
      header: {
        'content-type': 'application/json' // 默认值
      },
      success(res) {
        var data = res.data;
        for (var i = 0; i < data.length; i++) {
          data[i]['head'] = '../../../resource/images/index_file.png';
          data[i]['name'] = data[i]['order_details']['destination_name'];
          data[i]['time'] = data[i]['order_details']['create_time'];
          data[i]['reward'] = parseFloat(data[i]['order_details']['cost']);
          data[i]['quFileImg'] = '../../../resource/images/index_file.png';
          data[i]['quFile'] = data[i]['order_details']['content'];
          data[i]['quTimeImg'] = '../../../resource/images/index_time.png';
          data[i]['quTime'] = data[i]['order_details']['depart_time'];
          data[i]['quQiImg'] = '../../../resource/images/index_qi.png';
          data[i]['quQi'] = data[i]['order_details']['origin'];
          data[i]['quZhongImg'] = '../../../resource/images/index_zhong.png';
          data[i]['quZhong'] = data[i]['order_details']['terminus'];
          data[i]['qiangDan'] = '抢单';
          data[i]['yiGet'] = '已接单';
          data[i]['order'] = 0;
        }
        that.setData({
          template_zhuan: data
        })
      }
    })
  },

  takeOrders: function (e) {
    const that = this;
    console.log(e);
    console.log(that.data.template_zhuan);
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})